﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CueMounter.DokanStructure {
	public class DokanBinaryReadFile : DokanFile {
		private IBinaryProvider binaryFile;

		public DokanBinaryReadFile(string fileName, IBinaryProvider binaryFile) {
			Name = fileName;
			this.binaryFile = binaryFile;
		}

		public override void Dispose() {
			binaryFile.Dispose();
		}

		public override long Length {
			get {
				return binaryFile.Length;
			}
			set
			{
				binaryFile.Length = value;
			}
		}

		public override bool CanRead { get { return binaryFile.CanRead; } }
		public override bool CanWrite { get { return binaryFile.CanWrite; } }

		public override long Read(long fileOffset, byte[] buffer, long bufferOffset, long length)
		{
			return binaryFile.Read(fileOffset, buffer, bufferOffset, length);
		}

		public override long Write(long fileOffset, byte[] buffer, long bufferOffset, long length)
		{
			return binaryFile.Write(fileOffset, buffer, bufferOffset, length);
		}
	}
}
